<?php

namespace App\Process;

use App\Service\PayApi\Callback\MchPayCallbackNotifyService;
use App\Service\PayApi\Callback\PayCallbackService;
use App\Utils\CustomUtils;
use App\Utils\RedisUtils;
use Hyperf\Process\AbstractProcess;
use Hyperf\Di\Annotation\Inject;
use App\Service\EmailService;
use Hyperf\Process\ProcessManager;
use Hyperf\Utils\Coroutine;

/**
 * Class MchPayCallbackNotifyProcess
 * 商户支付回调通知 
 *
 * @package App\Process
 */
class MchPayCallbackNotifyProcess extends AbstractProcess {

    /**
     * @var string
     */
    public $name = 'merchant-pay-callback-notify';

    /**
     * @Inject()
     * @var MchPayCallbackNotifyService
     */
    private $MchPayCallbackNotifyService;

    public function handle (): void {

        while (ProcessManager::isRunning()) {

            // 创建协程处理队列
            co(function () {
                $this->MchPayCallbackNotifyService->handleMerchantNotifyQueue();
            });

            Coroutine::sleep(1);
        }

    }

}
